# 连接数据库
from sqlalchemy.ext.asyncio import AsyncSession
# 数据库表结构
from module_admin.entity.vo.employee_vo import DeleteEmployeeModel, EmployeeModel
# 数据库操作层
from module_admin.dao.employee_dao import EmployeeDao
# 下划线形式(snake_case)转小驼峰形式(camelCase)工具方法
from utils.common_util import CamelCaseUtil


class EmployeeService:
    """
    员工信息模块服务层
    """

    @classmethod
    async def get_employee_list_services(cls, query_db: AsyncSession, page_object: EmployeeModel, data_scope_sql: str, is_page: bool = False):
        """
        获取员工列表信息service

        :param query_db: orm对象
        :param page_object: 分页查询参数对象
        :param data_scope_sql: 数据权限对应的查询sql语句
        :param is_page: 是否开启分页
        :return: 员工列表信息对象
        """
        employee_list_result = await EmployeeDao.get_employee_list(query_db, page_object, data_scope_sql, is_page)

        return employee_list_result
    
    @classmethod
    async def add_employee_services(cls, query_db: AsyncSession, page_object: EmployeeModel):
        """
        新增员工信息service
        :param query_db: orm对象
        :param employee: 新增员工对象
        :return: 新增结果
        """
        result = await EmployeeDao.add_employee(query_db, page_object)
        return result